<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<sj:head jqueryui="true" jquerytheme="redmond" />
<script type="text/javascript">
	$.subscribe('rowselect', function(event, data) {
		var grid = event.originalEvent.grid;
		var sel_id = grid.jqGrid('getGridParam', 'selrow');
		var contactId = grid.jqGrid('getCell', sel_id, 'contactId');
		window.location = "contactAmendAction.action?ContactID="+contactId;		
	});

	function onClickClose() {
		history.go(-1);
	}

	function onClickSelect() {
		history.go(-1);
	}

	function onClickNone() {
		history.go(-1);
	}

	function onClickSearch() {
		window.location = "contactSearchAction.action";
	}
	function onClickCreate() {
		window.location = "contactCreateAction.action";
	}
</script>
</head>
<body>
	<s:url id="listContactActionUrl" action="listContactAction" />
	<s:form theme="simple" cssClass="yform" id="formContactList"
		action="listContactFormAction">
		<fieldset>
			<legend>CONTACT - MANAGER - APPLICATION </legend>
			<div class="type-text" style="float: clear;">
				<label for="echo">First Name: </label>
				<s:textfield id="firstName" name="firstName" />
				<label for="echo">Surname: </label>
				<s:textfield id="surName" name="surName" />
			</div>
			<div class="type-text"></div>
			<div class="type-button">
				<br>
				<sj:a button="true" onclick="onClickSearch()"
					formIds="formContactList">Search Contact</sj:a>
				<sj:a button="true" onclick="onClickNone()">None</sj:a>
				<sj:a button="true">Clear</sj:a>
				<sj:a button="true" onclick="onClickCreate()">Create</sj:a>
				<br> <br>
			</div>
			<sjg:grid id="gridtable" caption="Contact List" dataType="json"
				href="%{listContactActionUrl}" pager="true" gridModel="gridModel"
				rowNum="15" rownumbers="true" navigator="true"
				navigatorSearch="false" navigatorRefresh="true"
				navigatorDelete="false" navigatorAdd="false" navigatorEdit="false"
				onSelectRowTopics="rowselect">
				<sjg:gridColumn name="contactId" index="contactId"
					title="Contact ID" sortable="false" search="false" />
				<sjg:gridColumn name="contactName" index="contactName"
					title="Contact Name" sortable="false" search="false" />
				<sjg:gridColumn name="mobilePhone" index="mobilePhone"
					title="Mobie Phone" sortable="false" search="false" />
				<sjg:gridColumn name="email" index="email" title="Email"
					sortable="false" search="false" />
				<sjg:gridColumn name="contactType" index="contactType"
					title="Contact Type" sortable="false" search="false" />
				<sjg:gridColumn name="isActive" index="isActive" title="Is Active?"
					sortable="false" search="false" />
			</sjg:grid>
			<div>
				<br />
				<sj:submit button="true" value="Select" onclick="onClickSelect()" />
				<sj:submit button="true" value="Edit" />
				<sj:submit button="true" value="Close" onclick="onClickClose()" />
			</div>
		</fieldset>
	</s:form>
</body>
</html>
